Manufacturers of microcontrollers typically target the consumer and automotive markets and sell the same microcontrollers to the industrial markets. A wide variety of product families are offered, each of which offers multiple products differentiated with specific feature sets.
In the Industrial market, there is a demand for a wide variety of peripherals integrated on-chip with the microcontroller. This is due to the large number of applications; communication protocols and bus interfaces; data acquisition from multiple sensors and actuators; and controls of various motors.
This approach does not efficiently serve the needs of customers as it does not permit providing a ‘perfect’ match with customer requirements. Typically this approach forces customers to use products that are supersets of what are actually needed.
Prior microcontrollers do not effectively provide for the variety of peripherals needed in varied applications. Users of these microcontrollers must pick one of many microcontrollers that has the closest peripheral set that matches their requirements. In each application, a new microcontroller must be selected, or, alternatively, select one microcontroller that meets a superset of all requirements of all applications. The approach of using a separate microcontroller for each application increases costs by requiring the user to stock and buy each microcontroller. The approach of using a superset increases cost by making each microcontroller cost more.
In many, if not most, applications microcontrollers must provide for task-switching and multi-threading. Certain time-critical events, e.g., interrupts from timers, communication ports, or external circuits, interrupt whatever the microprocessor utilized in the microcontroller is doing at the time and re-direct the microprocessor to perform a higher priority task.
Software developers working on microcontroller based “hard real-time” embedded systems would often prefer not to use an RTOS (Real-Time Operating System), because by eliminating the RTOS, they could get complete control over the execution of their code thereby more easily obtaining very precise timing and control that are necessary for real-time or safety-critical functions. The down side of this approach was that without an RTOS, all of the other higher level, non real-time functions normally carried out by the RTOS also had to be developed as a proprietary software package. This often led to large proprietary software packages that were very difficult to debug and maintain over time.
Over time, as software development and maintenance costs continued to grow, embedded software developers migrated to using RTOS. RTOS vendors provide support, keeping the RTOS updated with new capabilities and fixing bugs etc. Although RTOS vendors provide methods for enabling real-time and safety-critical functions to be performed, the efficiency and determinism of these functions is impacted because the software developer has no direct control over code execution and must rely on the RTOS to manage multi-threaded context switches and interrupts.
Typical applications also require multi-threaded real time processing to handle various control and communications functions. These applications require a microprocessor to execute several hundreds of task switches per second and up to approximately 20 concurrent threads. This places an enormous amount of overhead burden on the microprocessor and increases firmware development schedule and cost.
When multiple tasks need to run on a prior art microprocessor, the RTOS grants each task a time slot on the microprocessor. A running task, “X”, sometimes needs to be suspended temporarily so that another task, “Y”, can be run for a time, after which task “X” is resumed. This suspension function is referred to as context switching. In prior systems context switching is performed by the RTOS saving the context of the task in the processor's memory at a predefined location.
The context of a task denotes its state: all the information required to resume the task at the point where it was interrupted. For a task running in software on a microprocessor, context includes the contents of the processor's registers, the data in the memory on which the task is operating, and information regarding the current state of execution of the task, such as the program counter. Software context switching presents functional and operational limitations. Reconfigurable hardware requires special handling. Both the software states and also the hardware states of the same task must be represented consistently.
Many of the features of modem microprocessors that improve their performance do so in a stochastic fashion, i.e. they increase average-case performance at the cost of a wide variation in the actual execution time from one time to another. Chief among these features is the cached memory architecture. If the code/data currently needed is in cache, then the operation is fast. If the code/data currently needed is not in cache, then the operation is delayed while the cache is filled. Stated another way, on one pass through a point in the control loop, the cache may contain all the information needed and the task is performed very fast, on another pass, the information may not be in cache and the task takes substantially longer.
In the description that follows, the term “deterministic” is utilized. In the context of the present invention, determinism pertains to time. A system that is “deterministic” is one in which every time a sequence of events is to occur, then the time that it takes to perform that sequence of events will always be the same or the variation in time will not be significant.